// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
#include "pch.h"
#include "FloatToStringPrecipitationConverter.h"

using namespace Weathr;
using namespace Platform;
using namespace Windows::UI::Xaml::Interop;

Object^ FloatToStringPrecipitationConverter::Convert(Object^ value, TypeName targetType, Object^ parameter, String^ language)
{
    (void) targetType; // Unused parameter
    (void) parameter;  // Unused parameter
    (void) language;   // Unused parameter

    auto boxedFloat32 = dynamic_cast<Box<float32>^>(value);
    if (boxedFloat32 == nullptr)
    {
        return ref new String();
    }

    auto floatValue = boxedFloat32->Value;
    String^ unit = "mm";

    auto s = floatValue.ToString() + " " + unit + " precipitation expected";
    return s;
}

Object^ FloatToStringPrecipitationConverter::ConvertBack(Object^ value, TypeName targetType, Object^ parameter, String^ language)
{
    (void) targetType; // Unused parameter
    (void) parameter;  // Unused parameter
    (void) language;   // Unused parameter

    throw ref new NotImplementedException();
}